package com.af.community.smart.business

import android.os.Bundle
import com.af.community.smart.base.BaseActivity
import com.af.community.smart.base.oneClick
import kotlinx.android.synthetic.main.activity_patrol_people_select.*
import org.jetbrains.anko.startActivity

class PatrolPeopleSelectActivity : BaseActivity() {

    private lateinit var mAction: String

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_patrol_people_select)
        initTitle(title = "人口类别")
    }

    override fun initTitle(title: String, name: String) {
        super.initTitle(title, name)
        mAction = intent.getStringExtra("action")

        patrol_stable.oneClick {
            when (mAction) {
                "add" -> {
                    intent.setClass(baseContext, PatrolPeopleAddActivity::class.java)
                    intent.putExtra("type", "1")
                    startActivity(intent)
                }
                "edit" -> {
                    intent.setClass(baseContext, PeopleEditFirstActivity::class.java)
                    startActivity(intent)
                }
            }
        }
        patrol_flow.oneClick {
            when (mAction) {
                "add" -> {
                    intent.setClass(baseContext, PatrolPeopleAddActivity::class.java)
                    intent.putExtra("type", "2")
                    startActivity(intent)
                }
                "edit" -> {
                    intent.setClass(baseContext, PeopleEditSecondActivity::class.java)
                    startActivity(intent)
                }
            }
        }
    }
}
